this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(t,e,i,n,s){"use strict";var r=function(t){babelHelpers.inherits(e,t);function e(t){var i;babelHelpers.classCallCheck(this,e);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(e).call(this,t));i.target=null;if(s.Type.isString(t.target)&&t.target!==""||s.Type.isFunction(t.target)||s.Type.isDomNode(t.target)){i.target=t.target}i.id=t.id||null;i.text=t.text;i.areaPadding=t.areaPadding;i.link=t.link||"";i.rounded=t.rounded||false;i.title=t.title||null;i.article=t.article||null;i.position=t.position||null;i.cursorMode=t.cursorMode||false;i.targetEvent=t.targetEvent||null;i.buttons=t.buttons||[];i.condition=t.condition||null;var n=s.Type.isPlainObject(t.events)?t.events:{};var r=function t(e){var r=s.Type.isFunction(n[e])?n[e]:s.Reflection.getClass(n[e]);if(r){i.subscribe(i.constructor.getFullEventName(e),(function(){r()}))}};for(var o in n){r(o)}return i}babelHelpers.createClass(e,[{key:"getCondition",value:function t(){return this.condition}},{key:"getTarget",value:function t(){if(s.Type.isString(this.target)&&this.target!==""){return document.querySelector(this.target)}if(s.Type.isFunction(this.target)){return this.target()}return this.target}},{key:"getTargetPos",value:function t(){if(s.Type.isDomNode(this.target)){return s.Dom.getPosition(this.target)}}},{key:"getId",value:function t(){return this.id}},{key:"getButtons",value:function t(){return this.buttons}},{key:"getAreaPadding",value:function t(){return this.areaPadding}},{key:"getRounded",value:function t(){return this.rounded}},{key:"getText",value:function t(){return this.text}},{key:"getLink",value:function t(){return this.link}},{key:"getTitle",value:function t(){return this.title}},{key:"getPosition",value:function t(){return this.position}},{key:"getArticle",value:function t(){return this.article}},{key:"getCursorMode",value:function t(){return this.cursorMode}},{key:"getTargetEvent",value:function t(){return this.targetEvent}},{key:"setTarget",value:function t(e){this.target=e}},{key:"initTargetEvent",value:function t(){if(s.Type.isFunction(this.targetEvent)){this.targetEvent();return}this.getTarget().dispatchEvent(new MouseEvent(this.targetEvent))}}],[{key:"getFullEventName",value:function t(e){return"Step:"+e}}]);return e}(s.Event.EventEmitter);var o=function t(){babelHelpers.classCallCheck(this,t)};babelHelpers.defineProperty(o,"WARNING","--condition-warning");babelHelpers.defineProperty(o,"ALERT","--condition-alert");babelHelpers.defineProperty(o,"PRIMARY","--condition-primary");var u,a,l,p,h,g,c,d,v,f,y,m,C,b,T,S,k;var P=function(t){babelHelpers.inherits(n,t);function n(){var t;var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,n);t=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(n).call(this,e));e=s.Type.isPlainObject(e)?e:{};t.steps=[];if(Array.isArray(e.steps)){e.steps.forEach((function(e){t.steps.push(new r(e))}))}if(t.steps.length<1){throw new Error("BX.UI.Tour.Guide: 'steps' argument is required.")}t.id="ui-tour-guide-"+s.Text.getRandom();t.setId(e.id);t.autoSave=false;t.popup=null;t.layout={overlay:null,element:null,title:null,text:null,link:null,btnContainer:null,nextBtn:null,backBtn:null,content:null,finalContent:null,counter:null,currentCounter:null,counterItems:[]};t.buttons=e.buttons||"";t.onEvents=e.onEvents||false;t.currentStepIndex=0;t.targetPos=null;t.clickOnBackBtn=false;t.helper=top.BX.Helper;t.finalStep=e.finalStep||false;t.finalText=e.finalText||"";t.finalTitle=e.finalTitle||"";t.simpleMode=e.simpleMode||false;t.setAutoSave(e.autoSave);var i=s.Type.isPlainObject(e.events)?e.events:{};var o=function e(n){var r=s.Type.isFunction(i[n])?i[n]:s.Reflection.getClass(i[n]);if(r){t.subscribe(t.constructor.getFullEventName(n),(function(){r()}))}};for(var u in i){o(u)}s.Event.bind(window,"resize",t.handleResizeWindow.bind(babelHelpers.assertThisInitialized(t)));return t}babelHelpers.createClass(n,[{key:"getId",value:function t(){return this.id}},{key:"setId",value:function t(e){if(s.Type.isString(e)&&e!==""){this.id=e}}},{key:"getAutoSave",value:function t(){return this.autoSave}},{key:"setAutoSave",value:function t(e){if(s.Type.isBoolean(e)){this.autoSave=e}}},{key:"save",value:function t(){var e="view_date_"+this.getId();s.userOptions.save("ui-tour",e,null,Math.floor(Date.now()/1e3));s.userOptions.send(null)}},{key:"start",value:function t(){this.emit(this.constructor.getFullEventName("onStart"),{guide:this});if(this.getAutoSave()){this.save()}this.setOverlay();var e=this.getPopup();e.show();if(this.popup.getPopupContainer()){s.Dom.removeClass(this.popup.getPopupContainer(),"popup-window-ui-tour-opacity")}this.showStep();s.Dom.addClass(this.layout.backBtn,"ui-tour-popup-btn-hidden");if(this.getCurrentStep().getTarget()){s.Dom.addClass(this.getCurrentStep().getTarget(),"ui-tour-selector")}}},{key:"close",value:function t(){if(this.currentStepIndex===this.steps.length&&this.onEvents)return;this.closeStep();this.emit(this.constructor.getFullEventName("onFinish"),{guide:this});if(this.popup){this.popup.destroy()}if(this.layout.cursor){s.Dom.remove(this.layout.cursor);this.layout.cursor=null}if(this.onEvents){this.increaseCurrentStepIndex()}s.Dom.remove(this.layout.overlay);s.Dom.removeClass(document.body,"ui-tour-body-overflow");if(this.getCurrentStep()&&this.getCurrentStep().getTarget()){this.getCurrentStep().getTarget().classList.remove("ui-tour-selector")}this.layout.overlay=null;this.layout.element=null;this.layout.title=null;this.layout.text=null;this.layout.link=null;this.layout.btnContainer=null;this.layout.nextBtn=null;this.layout.backBtn=null;this.layout.content=null;this.layout.finalContent=null;this.layout.counter=null;this.layout.currentCounter=null;this.layout.counterItems=[];this.popup=null}},{key:"showStep",value:function t(){var e=this;this.adjustEvents();s.Dom.removeClass(this.popup.getPopupContainer(),"popup-window-ui-tour-opacity");if(this.layout.element){s.Dom.removeClass(this.layout.element,"ui-tour-overlay-element-opacity")}if(this.layout.backBtn){setTimeout((function(){e.layout.backBtn.style.display="block"}),10)}this.setOverlayElementForm();if(this.getCurrentStep()){this.setCoords(this.getCurrentStep().getTarget())}this.setPopupData()}},{key:"showNextStep",value:function t(){if(this.currentStepIndex===this.steps.length){return}if(this.getCurrentStep().getCursorMode()){this.showCursor()}else{var e=this.getPopup();e.show();if(e.getPopupContainer()){s.Dom.removeClass(e.getPopupContainer(),"popup-window-ui-tour-opacity")}if(this.getCurrentStep()){this.setCoords(this.getCurrentStep().getTarget())}this.setPopupData()}this.adjustEvents();if(this.getCurrentStep()&&this.getCurrentStep().getTarget()){s.Dom.addClass(this.getCurrentStep().getTarget(),"ui-tour-selector")}}},{key:"adjustEvents",value:function t(){var e=this;var n=this.getCurrentStep();n.emit(n.constructor.getFullEventName("onShow"),{step:n,guide:this});if(n.getTarget()){var r=this.close.bind(this);var o=function t(o){if(o.isTrusted){r()}i.EventEmitter.emit("UI.Tour.Guide:clickTarget",e);s.Event.unbind(n.getTarget(),"click",t)};s.Event.bind(n.getTarget(),"click",o);this.subscribe("UI.Tour.Guide:onFinish",(function(){s.Event.unbind(n.getTarget(),"click",r)}));var u=n.getTarget().getBoundingClientRect();var a=s.Dom.getPosition(n.getTarget());if(!this.isTargetVisible(u)){this.scrollToTarget(a)}}}},{key:"closeStep",value:function t(){var e=this.getCurrentStep();if(e){e.emit(e.constructor.getFullEventName("onClose"),{step:e,guide:this});var i=e.getTarget();if(i){s.Dom.removeClass(i,"ui-tour-selector")}}}},{key:"setPopupPosition",value:function t(){if(!this.getCurrentStep().getTarget()||this.targetPos===null||this.getCurrentStep().getPosition()==="center"){this.getPopup().setBindElement(null);this.getPopup().setOffset({offsetLeft:0,offsetTop:0});this.getPopup().setAngle(false);this.getPopup().adjustPosition();return}var e=0;var i=-15;var n=0;var s="top";var r={forceTop:true,forceLeft:true,forceBindPosition:true};var o=this.getPopup().getPopupContainer().offsetWidth;var u=document.documentElement.clientWidth;if(this.getCurrentStep().getPosition()==="right"){s="left";e=this.targetPos.width+30;i=this.targetPos.height+this.getAreaPadding();if(this.targetPos.left+e+o>u){var a=this.targetPos.left-o;if(a>0){e=-o-30;s="right"}}}else if(this.getCurrentStep().getPosition()==="left"){s="right";e=-this.targetPos.width-(o-this.targetPos.width)-40;i=this.targetPos.height+this.getAreaPadding();if(this.targetPos.right+e+o<u){var l=this.targetPos.left-o;if(l<0){e=this.targetPos.width+40;s="left"}}}else{r.forceLeft=false;r.forceTop=false;if(this.getCurrentStep().getRounded()){if(!this.onEvents){i=-(this.layout.element.getAttribute("r")-this.targetPos.height/2+10)}n=0;e=this.targetPos.width/2}else if(this.targetPos.width<30){e=this.targetPos.width/2;i=-15;n=0}else{e=25;if(!this.onEvents){i=-(this.layout.element.getAttribute("height")/2-this.targetPos.height/2+10)}else{i=0}n=0}}var p=this.getCurrentStep().getTarget();if(this.getCurrentStep().getPosition()==="center")p=window;this.getPopup().setBindElement(p);this.getPopup().setOffset({offsetLeft:e,offsetTop:-i});this.getPopup().setAngle({position:s,offset:n});this.getPopup().adjustPosition(r)}},{key:"setOverlay",value:function t(){this.layout.overlay=s.Tag.render(u||(u=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<svg class="ui-tour-overlay" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" preserveAspectRatio="none">\n\t\t\t\t<mask id="hole">\n\t\t\t\t\t<defs>\n\t\t\t\t\t\t<filter id="ui-tour-filter">\n\t\t\t\t\t\t\t<feGaussianBlur stdDeviation="0"/>\n\t\t\t\t\t\t</filter>\n\t\t\t\t\t</defs>\n\t\t\t\t\t<rect x="0" y="0" width="100%" height="100%" fill="white"></rect>\n\t\t\t\t\t<rect id="rect" class="ui-tour-overlay-element ui-tour-overlay-element-rect" x="1035.5" y="338" width="422" rx="2" ry="2" height="58" filter="url(#ui-tour-filter)"></rect>\n\t\t\t\t\t<circle id="circle" class="ui-tour-overlay-element ui-tour-overlay-element-circle" cx="10" cy="10" r="10" filter="url(#ui-tour-filter)"></circle>\n\t\t\t\t</mask>\n\t\t\t\t<rect x="0" y="0" width="100%" height="100%" fill="#000" mask="url(#hole)"></rect>\n\t\t\t</svg>\n\t\t'])));s.Dom.addClass(document.body,"ui-tour-body-overflow");s.Dom.append(this.layout.overlay,document.body);this.setOverlayElementForm()}},{key:"setOverlayElementForm",value:function t(){if(this.getCurrentStep().getRounded()){this.layout.overlay.querySelector(".ui-tour-overlay-element-rect").style.display="none";this.layout.overlay.querySelector(".ui-tour-overlay-element-circle").style.display="block";this.layout.element=this.layout.overlay.querySelector(".ui-tour-overlay-element-circle")}else{this.layout.overlay.querySelector(".ui-tour-overlay-element-circle").style.display="none";this.layout.overlay.querySelector(".ui-tour-overlay-element-rect").style.display="block";this.layout.element=this.layout.overlay.querySelector(".ui-tour-overlay-element-rect")}return this.layout.element}},{key:"handleResizeWindow",value:function t(){if(this.layout.element&&this.getCurrentStep()){this.setCoords(this.getCurrentStep().getTarget())}}},{key:"setCoords",value:function t(e){if(!e){if(this.layout.element){this.layout.element.style.display="none"}return}this.targetPos=e.getBoundingClientRect();if(this.layout.element){this.layout.element.style.display="block";if(this.getCurrentStep().getRounded()){this.layout.element.setAttribute("cx",this.targetPos.left+this.targetPos.width/2);this.layout.element.setAttribute("cy",this.targetPos.top+this.targetPos.height/2);this.layout.element.setAttribute("r",this.targetPos.width/2+this.getAreaPadding())}else{this.layout.element.setAttribute("x",this.targetPos.left-this.getAreaPadding());this.layout.element.setAttribute("y",this.targetPos.top-this.getAreaPadding());this.layout.element.setAttribute("width",this.targetPos.width+this.getAreaPadding()*2);this.layout.element.setAttribute("height",this.targetPos.height+this.getAreaPadding()*2)}}}},{key:"getAreaPadding",value:function t(){var e=15;if(this.getCurrentStep().getAreaPadding()>=0){e=this.getCurrentStep().getAreaPadding()}return e}},{key:"increaseCurrentStepIndex",value:function t(){var e=this;this.currentStepIndex++;if(this.currentStepIndex+1===this.steps.length&&!this.finalStep&&!this.onEvents){setTimeout((function(){e.layout.nextBtn.textContent=s.Loc.getMessage("JS_UI_TOUR_BUTTON_CLOSE")}),200)}}},{key:"reduceCurrentStepIndex",value:function t(){var e=this;if(this.currentStepIndex===0){return}if(this.currentStepIndex<this.steps.length&&!this.finalStep){setTimeout((function(){e.layout.nextBtn.textContent=s.Loc.getMessage("JS_UI_TOUR_BUTTON")}),200)}this.currentStepIndex--}},{key:"getPopup",value:function t(){var n=this;if(!this.popup){var r;var o=this.getCurrentStep()?this.getCurrentStep().getTarget():window;var u="popup-window-ui-tour popup-window-ui-tour-opacity";if(this.getCurrentStep().getCondition()){var p;if(s.Type.isString(this.getCurrentStep().getCondition())){u=u+" --condition-"+this.getCurrentStep().getCondition().toLowerCase()}if(s.Type.isObject(this.getCurrentStep().getCondition())){var h;u=u+" --condition-"+((h=this.getCurrentStep().getCondition())===null||h===void 0?void 0:h.color.toLowerCase())}if(((p=this.getCurrentStep().getCondition())===null||p===void 0?void 0:p.top)!==false){u=u+" --condition"}}this.onEvents?u=u+" popup-window-ui-tour-animate":null;var g=[];if(this.getCurrentStep()&&this.getCurrentStep().getButtons().length>0){this.getCurrentStep().getButtons().forEach((function(t){g.push(new e.PopupWindowButton({text:t.text,className:"ui-btn ui-btn-sm ui-btn-primary ui-btn-round",events:{click:s.Type.isFunction(t.event)?t.event:null}}))}))}var c=this.onEvents?280:420;this.popup=new e.Popup({content:this.getContent(),bindElement:o,className:u,autoHide:this.onEvents?false:true,offsetTop:15,width:c,closeIcon:true,noAllPaddings:true,bindOptions:{forceTop:true,forceLeft:true,forceBindPosition:true},events:{onPopupClose:function t(e){if(e.destroyed===false&&n.onEvents)i.EventEmitter.emit("UI.Tour.Guide:onPopupClose",n);n.close()}},buttons:g});var d=s.Tag.render(a||(a=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-popup-condition-top">\n\t\t\t\t\t<div class="ui-tour-popup-condition-angle"></div>\n\t\t\t\t</div>\n\t\t\t'])));var v=s.Tag.render(l||(l=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-popup-condition-bottom"></div>\n\t\t\t'])));if(s.Type.isString(this.getCurrentStep().getCondition())){s.Dom.append(d,this.popup.getContentContainer())}if(s.Type.isObject(this.getCurrentStep().getCondition())){var f;if(((f=this.getCurrentStep().getCondition())===null||f===void 0?void 0:f.top)!==false){s.Dom.append(d,this.popup.getContentContainer())}}if(((r=this.getCurrentStep().getCondition())===null||r===void 0?void 0:r.bottom)!==false){s.Dom.append(v,this.popup.getContentContainer())}}return this.popup}},{key:"getContent",value:function t(){if(!this.layout.content){var e="";if(this.getCurrentStep().getLink()||this.getCurrentStep().getArticle()){e=this.getLink()}this.layout.content=s.Tag.render(p||(p=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-popup '," ",'" >\n\t\t\t\t\t','\n\t\t\t\t\t<div class="ui-tour-popup-content">\n\t\t\t\t\t\t',"\n\t\t\t\t\t\t","\n\t\t\t\t\t</div>\n\t\t\t\t\t",'\n\t\t\t\t\t<div class="ui-tour-popup-footer">\n\t\t\t\t\t\t<div class="ui-tour-popup-index">\n\t\t\t\t\t\t\t',"\n\t\t\t\t\t\t\t","\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t","\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t"])),this.simpleMode?"ui-tour-popup-simple":"",this.onEvents?"ui-tour-popup-events":"",this.getTitle(),this.getText(),e,e,this.onEvents?"":this.getCounterItems(),this.onEvents?"":this.getCurrentCounter(),this.onEvents?"":this.getBtnContainer())}return this.layout.content}},{key:"setPopupData",value:function t(){s.Event.unbindAll(this.layout.link,"click");this.getTitle().innerHTML=this.getCurrentStep().getTitle();this.getText().innerHTML=this.getCurrentStep().getText();if(this.getCurrentStep().getArticle()||this.getCurrentStep().getLink()){s.Dom.removeClass(this.layout.link,"ui-tour-popup-link-hide");if(this.getCurrentStep().getArticle()){s.Event.bind(this.layout.link,"click",this.handleClickLink.bind(this))}if(this.getCurrentStep().getLink()){this.getLink().setAttribute("href",this.getCurrentStep().getLink())}}else{s.Dom.addClass(this.layout.link,"ui-tour-popup-link-hide")}this.getCurrentCounter().textContent=s.Loc.getMessage("JS_UI_TOUR_STEP_INDEX_TEXT").replace("#NUMBER#",this.currentStepIndex+1).replace("#NUMBER_TOTAL#",this.steps.length);for(var e=0;e<this.steps.length;e++){if(this.layout.counterItems[e]){s.Dom.removeClass(this.layout.counterItems[e],"ui-tour-popup-index-item-current");s.Dom.removeClass(this.layout.counterItems[e],"ui-tour-popup-index-item-passed")}if(e===this.currentStepIndex){s.Dom.addClass(this.layout.counterItems[e],"ui-tour-popup-index-item-current")}else if(e<this.currentStepIndex){s.Dom.addClass(this.layout.counterItems[e],"ui-tour-popup-index-item-passed")}}this.setPopupPosition()}},{key:"handleClickLink",value:function t(){var e=this;event.preventDefault();if(!this.helper){this.helper=top.BX.Helper}this.helper.show("redirect=detail&code="+this.getCurrentStep().getArticle());if(this.onEvent){if(this.helper.isOpen())this.getPopup().setAutoHide(false);i.EventEmitter.subscribe(this.helper.getSlider(),"SidePanel.Slider:onCloseComplete",(function(){e.getPopup().setAutoHide(true)}))}}},{key:"getTitle",value:function t(){if(this.layout.title===null){this.layout.title=s.Tag.render(h||(h=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-popup-title"></div>\n\t\t\t'])))}return this.layout.title}},{key:"getText",value:function t(){if(this.layout.text===null){this.layout.text=s.Tag.render(g||(g=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-popup-text"></div>\n\t\t\t'])))}return this.layout.text}},{key:"getLink",value:function t(){if(!this.layout.link){this.layout.link=s.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<a target="_blank" href="" class="ui-tour-popup-link">\n\t\t\t\t\t',"\n\t\t\t\t</a>\n\t\t\t"])),s.Loc.getMessage("JS_UI_TOUR_LINK"))}return this.layout.link}},{key:"getCurrentCounter",value:function t(){if(this.layout.currentCounter===null){this.layout.currentCounter=s.Tag.render(d||(d=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<span class="ui-tour-popup-counter">\n\t\t\t\t\t',"\n\t\t\t\t</span>\n\t\t\t"])),s.Loc.getMessage("JS_UI_TOUR_STEP_INDEX_TEXT").replace("#NUMBER#",this.currentStepIndex+1).replace("#NUMBER_TOTAL#",this.steps.length))}return this.layout.currentCounter}},{key:"getBtnContainer",value:function t(){if(this.layout.btnContainer===null){this.layout.btnContainer=s.Tag.render(v||(v=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-popup-btn-block"></div>\n\t\t\t'])));this.layout.nextBtn=s.Tag.render(f||(f=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<button id="next" class="ui-tour-popup-btn-next">\n\t\t\t\t\t',"\n\t\t\t\t</button>\n\t\t\t"])),this.simpleMode?s.Loc.getMessage("JS_UI_TOUR_BUTTON_SIMPLE"):s.Loc.getMessage("JS_UI_TOUR_BUTTON"));this.layout.backBtn=s.Tag.render(y||(y=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<button id="back" class="ui-tour-popup-btn-back">\n\t\t\t\t</button>\n\t\t\t'])));s.Dom.append(this.layout.backBtn,this.layout.btnContainer);s.Dom.append(this.layout.nextBtn,this.layout.btnContainer);s.Event.bind(this.layout.nextBtn,"click",this.handleClickOnNextBtn.bind(this));s.Event.bind(this.layout.backBtn,"click",this.handleClickOnBackBtn.bind(this))}return this.layout.btnContainer}},{key:"getCounterItems",value:function t(){if(this.layout.counter===null){this.layout.counter=s.Tag.render(m||(m=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<span class="ui-tour-popup-index-items">\n\t\t\t\t</span>\n\t\t\t'])))}this.layout.counterItems=[];for(var e=0;e<this.steps.length;e++){var i=s.Tag.render(C||(C=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<span class="ui-tour-popup-index-item">\n\t\t\t\t</span>\n\t\t\t'])));this.layout.counterItems.push(i);s.Dom.append(i,this.layout.counter)}return this.layout.counter}},{key:"getCurrentStep",value:function t(){return this.steps[this.currentStepIndex]}},{key:"getPreviousStep",value:function t(){if(this.steps[this.currentStepIndex-1]){return this.steps[this.currentStepIndex-1]}}},{key:"handleClickOnNextBtn",value:function t(){var e=this;s.Dom.addClass(this.layout.element,"ui-tour-overlay-element-opacity");s.Dom.addClass(this.popup.getPopupContainer(),"popup-window-ui-tour-opacity");this.clickOnBackBtn=false;if(this.getCurrentStep()){this.closeStep()}this.increaseCurrentStepIndex();if(this.getCurrentStep()&&this.getCurrentStep().getTarget()){s.Dom.addClass(this.getCurrentStep().getTarget(),"ui-tour-selector")}if(this.currentStepIndex===this.steps.length){if(this.finalStep){this.setFinalStep()}else{this.close()}}else{setTimeout((function(){e.showStep()}),200);if(s.Dom.hasClass(this.layout.backBtn,"ui-tour-popup-btn-hidden")){s.Dom.removeClass(this.layout.backBtn,"ui-tour-popup-btn-hidden")}}}},{key:"handleClickOnBackBtn",value:function t(){var e=this;s.Dom.addClass(this.layout.element,"ui-tour-overlay-element-opacity");s.Dom.addClass(this.popup.getPopupContainer(),"popup-window-ui-tour-opacity");this.closeStep();this.reduceCurrentStepIndex();if(this.currentStepIndex===0){s.Dom.addClass(this.layout.backBtn,"ui-tour-popup-btn-hidden")}this.clickOnBackBtn=true;setTimeout((function(){e.layout.backBtn.style.display="none";e.showStep()}),200);if(this.getCurrentStep().getTarget()){s.Dom.addClass(this.getCurrentStep().getTarget(),"ui-tour-selector")}}},{key:"setFinalStep",value:function t(){this.layout.element.style.display="none";this.getPopup().destroy();var e=this.getFinalPopup();e.show();s.Dom.addClass(e.getPopupContainer(),"popup-window-ui-tour-final-show")}},{key:"getFinalPopup",value:function t(){this.popup=new e.Popup({content:this.getFinalContent(),className:"popup-window-ui-tour-final",offsetTop:this.onEvents?0:15,offsetLeft:35,maxWidth:430,minWidth:300});return this.popup}},{key:"getFinalContent",value:function t(){if(!this.layout.finalContent){this.layout.finalContent=s.Tag.render(b||(b=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-popup">\n\t\t\t\t\t<div class="ui-tour-popup-title">\n\t\t\t\t\t\t','\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="ui-tour-popup-content">\n\t\t\t\t\t\t<div class="ui-tour-popup-text">\n\t\t\t\t\t\t\t','\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="ui-tour-popup-footer-btn">\n\t\t\t\t\t\t',"\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t"])),this.finalTitle,this.finalText,this.getFinalBtn())}return this.layout.finalContent}},{key:"getFinalBtn",value:function t(){var e=[];if(this.buttons!==""){for(var i=0;i<this.buttons.length;i++){var n=s.Tag.render(T||(T=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<button class="','" onclick="','">\n\t\t\t\t\t',"\n\t\t\t\t\t</button>\n\t\t\t\t"])),this.buttons[i]["class"],this.buttons[i].events.click,this.buttons[i].text);e.push(n)}}else{var r=s.Tag.render(S||(S=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<button class="ui-btn ui-btn-sm ui-btn-primary ui-btn-round" onclick="','">\n\t\t\t\t',"\n\t\t\t\t</button>\n\t\t\t"])),this.close.bind(this),s.Loc.getMessage("JS_UI_TOUR_BUTTON_CLOSE"));e.push(r)}return e}},{key:"isTargetVisible",value:function t(e){return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}},{key:"scrollToTarget",value:function t(e){window.scrollTo(0,e.y-this.getAreaPadding())}},{key:"showCursor",value:function t(){var e=this;this.setCursorPos();setTimeout((function(){e.animateCursor()}),1e3)}},{key:"getCursor",value:function t(){var e=this;if(!this.layout.cursor){this.layout.cursor=s.Tag.render(k||(k=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-tour-cursor"></div>\n\t\t\t'])));s.Event.bind(this.layout.cursor,"transitionend",(function(){e.getCurrentStep().initTargetEvent()}));s.Dom.append(this.layout.cursor,document.body)}return this.layout.cursor}},{key:"setCursorPos",value:function t(){var e=this.getCurrentStep().getTargetPos();var i=e.left+e.width/2;if(i<0){i=0}this.cursorPaddingTop=30;var n=e.bottom+this.cursorPaddingTop;if(n<0){n=0}s.Dom.adjust(this.getCursor(),{style:{top:n+"px",left:i+"px"}})}},{key:"animateCursor",value:function t(){var e=this.cursorPaddingTop+this.getCurrentStep().getTargetPos().height/2;this.layout.cursor.style.transform="translateY(-"+e+"px)"}}],[{key:"getFullEventName",value:function t(e){return"UI.Tour.Guide:"+e}}]);return n}(s.Event.EventEmitter);babelHelpers.defineProperty(P,"ConditionColor",o);var w=function(){function t(){babelHelpers.classCallCheck(this,t);this.guides=new Map;this.autoStartQueue=[];this.currentGuide=null}babelHelpers.createClass(t,[{key:"create",value:function t(e){e=s.Type.isPlainObject(e)?e:{};var i=e.id;if(!s.Type.isString(i)&&i!==""){throw new Error("'id' parameter is required.")}if(this.get(i)){throw new Error("The tour instance with the same 'id' already exists.")}var n=new P(e);this.guides.set(n,true);return n}},{key:"add",value:function t(e){var i=this;var n=this.create(e);n.subscribe("UI.Tour.Guide:onFinish",(function(){i.handleTourFinish(n)}));if(!this.currentGuide){this.currentGuide=n;n.start()}else{this.autoStartQueue.push(n)}}},{key:"get",value:function t(e){return this.guides.get(e)}},{key:"remove",value:function t(e){this.guides["delete"](e)}},{key:"getCurrentGuide",value:function t(){return this.currentGuide}},{key:"handleTourFinish",value:function t(e){this.currentGuide=null;this.remove(e.getId());var i=this.autoStartQueue.shift();if(i){this.currentGuide=i;i.start()}}}]);return t}();var E=new w;t.Guide=P;t.Step=r;t.Manager=E})(this.BX.UI.Tour=this.BX.UI.Tour||{},BX.Main,BX.Event,BX,BX);
//# sourceMappingURL=tour.bundle.map.js